//
//  DemoViewController.swift
//  WeiBo
//
//  Created by Wishing.Star on 2017/1/14.
//  Copyright © 2017年 Wishing.Star. All rights reserved.
//

import UIKit

class DemoViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        //此时所在页，是计算当前navigationController的子控制器数，即根控制器+其他页面子控制器数（根控制器为子控制器栈中第一个子控制器（栈底控制器），其他页面子控制器以入栈的方式在顶部进行累加）
        title = "第\(navigationController?.childViewControllers.count ?? 0)页"

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    func nextPageTest() {
        let vc = DemoViewController()
        navigationController?.pushViewController(vc, animated: true)
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
extension DemoViewController {
    override func SetupUI() {
        super.SetupUI()
        
//        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "下一页", style: .plain, target: self, action: #selector(nextPageTest))
        //替换默认的navigationItem为自定义navItem
        navItem.rightBarButtonItem = UIBarButtonItem(title: "下一页", target: self, action: #selector(nextPageTest))
        
    }
}
